package com.gitee.web.goods.service;

import com.gitee.fastmybatis.core.support.BaseService;
import com.gitee.web.goods.entity.Goods;
import com.gitee.web.goods.mapper.GoodsMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author thc
 */
@Service
public class GoodsService extends BaseService<Goods, Integer, GoodsMapper> {

    // 非主数据源必须指定transactionManager,格式:transactionManager+数据源别名
    // 别名即spring.multi-datasource.goods.xx中的goods
    @Transactional(transactionManager = "transactionManagergoods", rollbackFor = Exception.class)
    public int updateGoods(Goods goods) {
        int update = this.update(goods);
        int i = 1 / 0;
        return update;
    }
}
